﻿/**  PACS v1.0
* YX_StudyInfo.cs
*
* 类 名： YX_StudyInfo
*
* Ver    变更日期             负责人  变更内容
* ───────────────────────────────────
* V0.01  2018/6/5 15:24:41   douwd    初版
*
*/
using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace Pacs.DAL
{
	/// <summary>
	/// 数据访问类:YX_StudyInfo
	/// </summary>
	public partial class YX_StudyInfo
	{
		public YX_StudyInfo()
		{}
		#region  Method


		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(string ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from YX_StudyInfo");
			strSql.Append(" where ID='"+ID+"' ");
			return DbHelperSQL.Exists(strSql.ToString());
		}

		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(Pacs.Model.YX_StudyInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			StringBuilder strSql1=new StringBuilder();
			StringBuilder strSql2=new StringBuilder();
			if (model.ID != null)
			{
				strSql1.Append("ID,");
				strSql2.Append("'"+model.ID+"',");
			}
			if (model.YW_PatientVisitInfoID != null)
			{
				strSql1.Append("YW_PatientVisitInfoID,");
				strSql2.Append("'"+model.YW_PatientVisitInfoID+"',");
			}
			if (model.JiuZhenNO != null)
			{
				strSql1.Append("JiuZhenNO,");
				strSql2.Append("'"+model.JiuZhenNO+"',");
			}
			if (model.JB_PatientBasicInfoID != null)
			{
				strSql1.Append("JB_PatientBasicInfoID,");
				strSql2.Append("'"+model.JB_PatientBasicInfoID+"',");
			}
			if (model.SheBeiLiuShuiHao != null)
			{
				strSql1.Append("SheBeiLiuShuiHao,");
				strSql2.Append("'"+model.SheBeiLiuShuiHao+"',");
			}
			if (model.JianChaYiShengID != null)
			{
				strSql1.Append("JianChaYiShengID,");
				strSql2.Append("'"+model.JianChaYiShengID+"',");
			}
			if (model.JianChaYiShengXingMing != null)
			{
				strSql1.Append("JianChaYiShengXingMing,");
				strSql2.Append("'"+model.JianChaYiShengXingMing+"',");
			}
			if (model.PaiPianYiShengNO != null)
			{
				strSql1.Append("PaiPianYiShengNO,");
				strSql2.Append("'"+model.PaiPianYiShengNO+"',");
			}
			if (model.PaiPianShiJian != null)
			{
				strSql1.Append("PaiPianShiJian,");
				strSql2.Append("'"+model.PaiPianShiJian+"',");
			}
			if (model.RenTiBuWei != null)
			{
				strSql1.Append("RenTiBuWei,");
				strSql2.Append("'"+model.RenTiBuWei+"',");
			}
			if (model.RenTiBuWeiNO != null)
			{
				strSql1.Append("RenTiBuWeiNO,");
				strSql2.Append("'"+model.RenTiBuWeiNO+"',");
			}
			if (model.RenTiBuWeiID != null)
			{
				strSql1.Append("RenTiBuWeiID,");
				strSql2.Append("'"+model.RenTiBuWeiID+"',");
			}
			if (model.PaiPianBuWeiNO != null)
			{
				strSql1.Append("PaiPianBuWeiNO,");
				strSql2.Append("'"+model.PaiPianBuWeiNO+"',");
			}
			if (model.PaiPianBuWeiID != null)
			{
				strSql1.Append("PaiPianBuWeiID,");
				strSql2.Append("'"+model.PaiPianBuWeiID+"',");
			}
			if (model.PaiPianBuWei != null)
			{
				strSql1.Append("PaiPianBuWei,");
				strSql2.Append("'"+model.PaiPianBuWei+"',");
			}
			if (model.PaiPianXiangMuNO != null)
			{
				strSql1.Append("PaiPianXiangMuNO,");
				strSql2.Append("'"+model.PaiPianXiangMuNO+"',");
			}
			if (model.PaiPianXiangMu != null)
			{
				strSql1.Append("PaiPianXiangMu,");
				strSql2.Append("'"+model.PaiPianXiangMu+"',");
			}
			if (model.PaiPianXiangMuID != null)
			{
				strSql1.Append("PaiPianXiangMuID,");
				strSql2.Append("'"+model.PaiPianXiangMuID+"',");
			}
			if (model.JianChaLeiXing != null)
			{
				strSql1.Append("JianChaLeiXing,");
				strSql2.Append("'"+model.JianChaLeiXing+"',");
			}
			if (model.JianChaLeiXingNO != null)
			{
				strSql1.Append("JianChaLeiXingNO,");
				strSql2.Append("'"+model.JianChaLeiXingNO+"',");
			}
			if (model.JianChaFangfaNO != null)
			{
				strSql1.Append("JianChaFangfaNO,");
				strSql2.Append("'"+model.JianChaFangfaNO+"',");
			}
			if (model.JianChaFangFaID != null)
			{
				strSql1.Append("JianChaFangFaID,");
				strSql2.Append("'"+model.JianChaFangFaID+"',");
			}
			if (model.JianChaFangFa != null)
			{
				strSql1.Append("JianChaFangFa,");
				strSql2.Append("'"+model.JianChaFangFa+"',");
			}
			if (model.JianChaSheBeiID != null)
			{
				strSql1.Append("JianChaSheBeiID,");
				strSql2.Append("'"+model.JianChaSheBeiID+"',");
			}
			if (model.JianChaSheBeiMing != null)
			{
				strSql1.Append("JianChaSheBeiMing,");
				strSql2.Append("'"+model.JianChaSheBeiMing+"',");
			}
			if (model.JianChaTuPianShuLiang != null)
			{
				strSql1.Append("JianChaTuPianShuLiang,");
				strSql2.Append(""+model.JianChaTuPianShuLiang+",");
			}
			if (model.JianChaZhuangTai != null)
			{
				strSql1.Append("JianChaZhuangTai,");
				strSql2.Append("'"+model.JianChaZhuangTai+"',");
			}
			if (model.PaiPianJiaGe != null)
			{
				strSql1.Append("PaiPianJiaGe,");
				strSql2.Append("'"+model.PaiPianJiaGe+"',");
			}
			if (model.BaoGaoID != null)
			{
				strSql1.Append("BaoGaoID,");
				strSql2.Append("'"+model.BaoGaoID+"',");
			}
			if (model.JianChaShiID != null)
			{
				strSql1.Append("JianChaShiID,");
				strSql2.Append("'"+model.JianChaShiID+"',");
			}
			if (model.JianChaShiMing != null)
			{
				strSql1.Append("JianChaShiMing,");
				strSql2.Append("'"+model.JianChaShiMing+"',");
			}
			if (model.BeiZhu != null)
			{
				strSql1.Append("BeiZhu,");
				strSql2.Append("'"+model.BeiZhu+"',");
			}
			strSql.Append("insert into YX_StudyInfo(");
			strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
			strSql.Append(")");
			strSql.Append(" values (");
			strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
			strSql.Append(")");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(Pacs.Model.YX_StudyInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update YX_StudyInfo set ");
			if (model.YW_PatientVisitInfoID != null)
			{
				strSql.Append("YW_PatientVisitInfoID='"+model.YW_PatientVisitInfoID+"',");
			}
			else
			{
				strSql.Append("YW_PatientVisitInfoID= null ,");
			}
			if (model.JiuZhenNO != null)
			{
				strSql.Append("JiuZhenNO='"+model.JiuZhenNO+"',");
			}
			else
			{
				strSql.Append("JiuZhenNO= null ,");
			}
			if (model.JB_PatientBasicInfoID != null)
			{
				strSql.Append("JB_PatientBasicInfoID='"+model.JB_PatientBasicInfoID+"',");
			}
			else
			{
				strSql.Append("JB_PatientBasicInfoID= null ,");
			}
			if (model.SheBeiLiuShuiHao != null)
			{
				strSql.Append("SheBeiLiuShuiHao='"+model.SheBeiLiuShuiHao+"',");
			}
			else
			{
				strSql.Append("SheBeiLiuShuiHao= null ,");
			}
			if (model.JianChaYiShengID != null)
			{
				strSql.Append("JianChaYiShengID='"+model.JianChaYiShengID+"',");
			}
			else
			{
				strSql.Append("JianChaYiShengID= null ,");
			}
			if (model.JianChaYiShengXingMing != null)
			{
				strSql.Append("JianChaYiShengXingMing='"+model.JianChaYiShengXingMing+"',");
			}
			else
			{
				strSql.Append("JianChaYiShengXingMing= null ,");
			}
			if (model.PaiPianYiShengNO != null)
			{
				strSql.Append("PaiPianYiShengNO='"+model.PaiPianYiShengNO+"',");
			}
			else
			{
				strSql.Append("PaiPianYiShengNO= null ,");
			}
			if (model.PaiPianShiJian != null)
			{
				strSql.Append("PaiPianShiJian='"+model.PaiPianShiJian+"',");
			}
			else
			{
				strSql.Append("PaiPianShiJian= null ,");
			}
			if (model.RenTiBuWei != null)
			{
				strSql.Append("RenTiBuWei='"+model.RenTiBuWei+"',");
			}
			else
			{
				strSql.Append("RenTiBuWei= null ,");
			}
			if (model.RenTiBuWeiNO != null)
			{
				strSql.Append("RenTiBuWeiNO='"+model.RenTiBuWeiNO+"',");
			}
			else
			{
				strSql.Append("RenTiBuWeiNO= null ,");
			}
			if (model.RenTiBuWeiID != null)
			{
				strSql.Append("RenTiBuWeiID='"+model.RenTiBuWeiID+"',");
			}
			else
			{
				strSql.Append("RenTiBuWeiID= null ,");
			}
			if (model.PaiPianBuWeiNO != null)
			{
				strSql.Append("PaiPianBuWeiNO='"+model.PaiPianBuWeiNO+"',");
			}
			else
			{
				strSql.Append("PaiPianBuWeiNO= null ,");
			}
			if (model.PaiPianBuWeiID != null)
			{
				strSql.Append("PaiPianBuWeiID='"+model.PaiPianBuWeiID+"',");
			}
			else
			{
				strSql.Append("PaiPianBuWeiID= null ,");
			}
			if (model.PaiPianBuWei != null)
			{
				strSql.Append("PaiPianBuWei='"+model.PaiPianBuWei+"',");
			}
			else
			{
				strSql.Append("PaiPianBuWei= null ,");
			}
			if (model.PaiPianXiangMuNO != null)
			{
				strSql.Append("PaiPianXiangMuNO='"+model.PaiPianXiangMuNO+"',");
			}
			else
			{
				strSql.Append("PaiPianXiangMuNO= null ,");
			}
			if (model.PaiPianXiangMu != null)
			{
				strSql.Append("PaiPianXiangMu='"+model.PaiPianXiangMu+"',");
			}
			else
			{
				strSql.Append("PaiPianXiangMu= null ,");
			}
			if (model.PaiPianXiangMuID != null)
			{
				strSql.Append("PaiPianXiangMuID='"+model.PaiPianXiangMuID+"',");
			}
			else
			{
				strSql.Append("PaiPianXiangMuID= null ,");
			}
			if (model.JianChaLeiXing != null)
			{
				strSql.Append("JianChaLeiXing='"+model.JianChaLeiXing+"',");
			}
			else
			{
				strSql.Append("JianChaLeiXing= null ,");
			}
			if (model.JianChaLeiXingNO != null)
			{
				strSql.Append("JianChaLeiXingNO='"+model.JianChaLeiXingNO+"',");
			}
			else
			{
				strSql.Append("JianChaLeiXingNO= null ,");
			}
			if (model.JianChaFangfaNO != null)
			{
				strSql.Append("JianChaFangfaNO='"+model.JianChaFangfaNO+"',");
			}
			else
			{
				strSql.Append("JianChaFangfaNO= null ,");
			}
			if (model.JianChaFangFaID != null)
			{
				strSql.Append("JianChaFangFaID='"+model.JianChaFangFaID+"',");
			}
			else
			{
				strSql.Append("JianChaFangFaID= null ,");
			}
			if (model.JianChaFangFa != null)
			{
				strSql.Append("JianChaFangFa='"+model.JianChaFangFa+"',");
			}
			else
			{
				strSql.Append("JianChaFangFa= null ,");
			}
			if (model.JianChaSheBeiID != null)
			{
				strSql.Append("JianChaSheBeiID='"+model.JianChaSheBeiID+"',");
			}
			else
			{
				strSql.Append("JianChaSheBeiID= null ,");
			}
			if (model.JianChaSheBeiMing != null)
			{
				strSql.Append("JianChaSheBeiMing='"+model.JianChaSheBeiMing+"',");
			}
			else
			{
				strSql.Append("JianChaSheBeiMing= null ,");
			}
			if (model.JianChaTuPianShuLiang != null)
			{
				strSql.Append("JianChaTuPianShuLiang="+model.JianChaTuPianShuLiang+",");
			}
			else
			{
				strSql.Append("JianChaTuPianShuLiang= null ,");
			}
			if (model.JianChaZhuangTai != null)
			{
				strSql.Append("JianChaZhuangTai='"+model.JianChaZhuangTai+"',");
			}
			else
			{
				strSql.Append("JianChaZhuangTai= null ,");
			}
			if (model.PaiPianJiaGe != null)
			{
				strSql.Append("PaiPianJiaGe='"+model.PaiPianJiaGe+"',");
			}
			else
			{
				strSql.Append("PaiPianJiaGe= null ,");
			}
			if (model.BaoGaoID != null)
			{
				strSql.Append("BaoGaoID='"+model.BaoGaoID+"',");
			}
			else
			{
				strSql.Append("BaoGaoID= null ,");
			}
			if (model.JianChaShiID != null)
			{
				strSql.Append("JianChaShiID='"+model.JianChaShiID+"',");
			}
			else
			{
				strSql.Append("JianChaShiID= null ,");
			}
			if (model.JianChaShiMing != null)
			{
				strSql.Append("JianChaShiMing='"+model.JianChaShiMing+"',");
			}
			else
			{
				strSql.Append("JianChaShiMing= null ,");
			}
			if (model.BeiZhu != null)
			{
				strSql.Append("BeiZhu='"+model.BeiZhu+"',");
			}
			else
			{
				strSql.Append("BeiZhu= null ,");
			}
			int n = strSql.ToString().LastIndexOf(",");
			strSql.Remove(n, 1);
			strSql.Append(" where ID='"+ model.ID+"' ");
			int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(string ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from YX_StudyInfo ");
			strSql.Append(" where ID='"+ID+"' " );
			int rowsAffected=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rowsAffected > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string IDlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from YX_StudyInfo ");
			strSql.Append(" where ID in ("+IDlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Pacs.Model.YX_StudyInfo GetModel(string ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1  ");
			strSql.Append(" ID,YW_PatientVisitInfoID,JiuZhenNO,JB_PatientBasicInfoID,SheBeiLiuShuiHao,JianChaYiShengID,JianChaYiShengXingMing,PaiPianYiShengNO,PaiPianShiJian,RenTiBuWei,RenTiBuWeiNO,RenTiBuWeiID,PaiPianBuWeiNO,PaiPianBuWeiID,PaiPianBuWei,PaiPianXiangMuNO,PaiPianXiangMu,PaiPianXiangMuID,JianChaLeiXing,JianChaLeiXingNO,JianChaFangfaNO,JianChaFangFaID,JianChaFangFa,JianChaSheBeiID,JianChaSheBeiMing,JianChaTuPianShuLiang,JianChaZhuangTai,PaiPianJiaGe,BaoGaoID,JianChaShiID,JianChaShiMing,BeiZhu ");
			strSql.Append(" from YX_StudyInfo ");
			strSql.Append(" where ID='"+ID+"' " );
			Pacs.Model.YX_StudyInfo model=new Pacs.Model.YX_StudyInfo();
			DataSet ds=DbHelperSQL.Query(strSql.ToString());
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Pacs.Model.YX_StudyInfo DataRowToModel(DataRow row)
		{
			Pacs.Model.YX_StudyInfo model=new Pacs.Model.YX_StudyInfo();
			if (row != null)
			{
				if(row["ID"]!=null)
				{
					model.ID=row["ID"].ToString();
				}
				if(row["YW_PatientVisitInfoID"]!=null)
				{
					model.YW_PatientVisitInfoID=row["YW_PatientVisitInfoID"].ToString();
				}
				if(row["JiuZhenNO"]!=null)
				{
					model.JiuZhenNO=row["JiuZhenNO"].ToString();
				}
				if(row["JB_PatientBasicInfoID"]!=null)
				{
					model.JB_PatientBasicInfoID=row["JB_PatientBasicInfoID"].ToString();
				}
				if(row["SheBeiLiuShuiHao"]!=null)
				{
					model.SheBeiLiuShuiHao=row["SheBeiLiuShuiHao"].ToString();
				}
				if(row["JianChaYiShengID"]!=null)
				{
					model.JianChaYiShengID=row["JianChaYiShengID"].ToString();
				}
				if(row["JianChaYiShengXingMing"]!=null)
				{
					model.JianChaYiShengXingMing=row["JianChaYiShengXingMing"].ToString();
				}
				if(row["PaiPianYiShengNO"]!=null)
				{
					model.PaiPianYiShengNO=row["PaiPianYiShengNO"].ToString();
				}
				if(row["PaiPianShiJian"]!=null && row["PaiPianShiJian"].ToString()!="")
				{
					model.PaiPianShiJian=DateTime.Parse(row["PaiPianShiJian"].ToString());
				}
				if(row["RenTiBuWei"]!=null)
				{
					model.RenTiBuWei=row["RenTiBuWei"].ToString();
				}
				if(row["RenTiBuWeiNO"]!=null)
				{
					model.RenTiBuWeiNO=row["RenTiBuWeiNO"].ToString();
				}
				if(row["RenTiBuWeiID"]!=null)
				{
					model.RenTiBuWeiID=row["RenTiBuWeiID"].ToString();
				}
				if(row["PaiPianBuWeiNO"]!=null)
				{
					model.PaiPianBuWeiNO=row["PaiPianBuWeiNO"].ToString();
				}
				if(row["PaiPianBuWeiID"]!=null)
				{
					model.PaiPianBuWeiID=row["PaiPianBuWeiID"].ToString();
				}
				if(row["PaiPianBuWei"]!=null)
				{
					model.PaiPianBuWei=row["PaiPianBuWei"].ToString();
				}
				if(row["PaiPianXiangMuNO"]!=null)
				{
					model.PaiPianXiangMuNO=row["PaiPianXiangMuNO"].ToString();
				}
				if(row["PaiPianXiangMu"]!=null)
				{
					model.PaiPianXiangMu=row["PaiPianXiangMu"].ToString();
				}
				if(row["PaiPianXiangMuID"]!=null)
				{
					model.PaiPianXiangMuID=row["PaiPianXiangMuID"].ToString();
				}
				if(row["JianChaLeiXing"]!=null)
				{
					model.JianChaLeiXing=row["JianChaLeiXing"].ToString();
				}
				if(row["JianChaLeiXingNO"]!=null)
				{
					model.JianChaLeiXingNO=row["JianChaLeiXingNO"].ToString();
				}
				if(row["JianChaFangfaNO"]!=null)
				{
					model.JianChaFangfaNO=row["JianChaFangfaNO"].ToString();
				}
				if(row["JianChaFangFaID"]!=null)
				{
					model.JianChaFangFaID=row["JianChaFangFaID"].ToString();
				}
				if(row["JianChaFangFa"]!=null)
				{
					model.JianChaFangFa=row["JianChaFangFa"].ToString();
				}
				if(row["JianChaSheBeiID"]!=null)
				{
					model.JianChaSheBeiID=row["JianChaSheBeiID"].ToString();
				}
				if(row["JianChaSheBeiMing"]!=null)
				{
					model.JianChaSheBeiMing=row["JianChaSheBeiMing"].ToString();
				}
				if(row["JianChaTuPianShuLiang"]!=null && row["JianChaTuPianShuLiang"].ToString()!="")
				{
					model.JianChaTuPianShuLiang=int.Parse(row["JianChaTuPianShuLiang"].ToString());
				}
				if(row["JianChaZhuangTai"]!=null)
				{
					model.JianChaZhuangTai=row["JianChaZhuangTai"].ToString();
				}
				if(row["PaiPianJiaGe"]!=null)
				{
					model.PaiPianJiaGe=row["PaiPianJiaGe"].ToString();
				}
				if(row["BaoGaoID"]!=null)
				{
					model.BaoGaoID=row["BaoGaoID"].ToString();
				}
				if(row["JianChaShiID"]!=null)
				{
					model.JianChaShiID=row["JianChaShiID"].ToString();
				}
				if(row["JianChaShiMing"]!=null)
				{
					model.JianChaShiMing=row["JianChaShiMing"].ToString();
				}
				if(row["BeiZhu"]!=null)
				{
					model.BeiZhu=row["BeiZhu"].ToString();
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ID,YW_PatientVisitInfoID,JiuZhenNO,JB_PatientBasicInfoID,SheBeiLiuShuiHao,JianChaYiShengID,JianChaYiShengXingMing,PaiPianYiShengNO,PaiPianShiJian,RenTiBuWei,RenTiBuWeiNO,RenTiBuWeiID,PaiPianBuWeiNO,PaiPianBuWeiID,PaiPianBuWei,PaiPianXiangMuNO,PaiPianXiangMu,PaiPianXiangMuID,JianChaLeiXing,JianChaLeiXingNO,JianChaFangfaNO,JianChaFangFaID,JianChaFangFa,JianChaSheBeiID,JianChaSheBeiMing,JianChaTuPianShuLiang,JianChaZhuangTai,PaiPianJiaGe,BaoGaoID,JianChaShiID,JianChaShiMing,BeiZhu ");
			strSql.Append(" FROM YX_StudyInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" ID,YW_PatientVisitInfoID,JiuZhenNO,JB_PatientBasicInfoID,SheBeiLiuShuiHao,JianChaYiShengID,JianChaYiShengXingMing,PaiPianYiShengNO,PaiPianShiJian,RenTiBuWei,RenTiBuWeiNO,RenTiBuWeiID,PaiPianBuWeiNO,PaiPianBuWeiID,PaiPianBuWei,PaiPianXiangMuNO,PaiPianXiangMu,PaiPianXiangMuID,JianChaLeiXing,JianChaLeiXingNO,JianChaFangfaNO,JianChaFangFaID,JianChaFangFa,JianChaSheBeiID,JianChaSheBeiMing,JianChaTuPianShuLiang,JianChaZhuangTai,PaiPianJiaGe,BaoGaoID,JianChaShiID,JianChaShiMing,BeiZhu ");
			strSql.Append(" FROM YX_StudyInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM YX_StudyInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.ID desc");
			}
			strSql.Append(")AS Row, T.*  from YX_StudyInfo T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		*/

		#endregion  Method
		#region  MethodEx

		#endregion  MethodEx
	}
}

